﻿#ifndef PURCHASEWIDGET_H
#define PURCHASEWIDGET_H

#include <QWidget>
#include <QTableView>
#include <QMenu>
#include <QAction>

class SqlHelp;
class BasicDataWidget;
class QStandardItemModel;
class RecvTableModel;
class GoodSqlHelp;
class QProgressBar;


namespace Ui {
class PurchaseWidget;
}

class PurchaseWidget : public QWidget
{
    Q_OBJECT
    
public:
    explicit PurchaseWidget(QWidget *parent = 0);
    ~PurchaseWidget();
    void InitForm();
    void InitParamete();
    void CreateConnect();
    void initTableView(QTableView *tableView, int rowHeight = 25, bool headVisible = true, bool edit = false);    //初始化表格
    QString setProgressBarQss(QProgressBar *bar,
                                            int barHeight = 8,                             //进度条高度
                                            int barRadius = 5,                             //进度条半径
                                            int fontSize = 9,                              //文字字号
                                            const QString &normalColor = "#E8EDF2",        //正常颜色
                                            const QString &chunkColor = "green");        //进度颜色

    void closeProgressBarAnimation();
private slots:
    //商品主档查询
    void on_Query_pushButton_clicked();
    //选中一行数据
private slots:
    //添加商品
    void on_pbnAddGoodsOk_clicked();
    //删除一行商品信息
    void on_Delete_pushButton_clicked();
    //修改一行商品信息
    void on_Modefy_pushButton_clicked();
    //增加单位
    void on_addUnit_pushButton_clicked();
    //增加种类
    void on_addCategorie_pushButton_clicked();
    //删除单位
    void on_deleteUnit_pushButton_clicked();
    //删除种类
    void on_deleteCategorie_pushButton_clicked();
    //添加多个条码
    void on_multBarCode_toolButton_clicked();

    //右键添加条码
    void addBarCode(bool checked);

    bool eventFilter(QObject *watched, QEvent *event) override;
    //刷新
    void on_flush_pushButton_clicked();
    //导入
    void on_exportIn_pushButton_clicked();
    //导出
    void on_exportOut_pushButton_clicked();

private:
    Ui::PurchaseWidget *ui;
    GoodSqlHelp *m_pGoodsSqlhelp;
    RecvTableModel *m_pStandModel;
    BasicDataWidget *m_pBascWidget;

    QMenu * m_popMenu;
    QAction *m_actionCode;
};

#endif // PURCHASEWIDGET_H
